/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.kx.insta.traitement;

import com.temboo.Library.Facebook.Reading.GetUnreadMessages;
import com.temboo.Library.Facebook.Reading.GetUnreadMessages.GetUnreadMessagesInputSet;
import com.temboo.Library.Facebook.Reading.GetUnreadMessages.GetUnreadMessagesResultSet;
import com.temboo.Library.Facebook.Reading.Likes;
import com.temboo.Library.Facebook.Reading.Likes.LikesInputSet;
import com.temboo.Library.Facebook.Reading.Likes.LikesResultSet;
import com.temboo.core.TembooException;
import com.temboo.core.TembooSession;
import org.json.JSONArray;
import org.json.JSONException;

/**
 *
 * @author KX
 */
public class FacebookBean implements SocialNetworkBeanInterface{

    @Override
    public TembooSession connect() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    

    
    @Override
    public void showUnreadLikes (TembooSession session) throws TembooException, JSONException
    {
        
        // Instantiate the Choreo, using a previously instantiated TembooSession object, eg:
// TembooSession session = new TembooSession("smalten", "myFirstApp", "d7c2e7cf553542639bfd278829fb9ae4");

            Likes likesChoreo = new Likes(session);

            // Get an InputSet object for the choreo
            LikesInputSet likesInputs = likesChoreo.newInputSet();

            // Set inputs
            likesInputs.set_AccessToken("CAAE5ZAUMG824BAJv4MXBZAupoAbb6rSVZA4ydUw3WwmOlCTGSeSvWHXDvosEp62apjAYHO4eUpfYTAtxlyC1u3ZCkCLW0dGrwaa4Q7J4p1duZBQJ5hms6oi8qqgYnfx85qYFXqZBh12FM0F5utgQ4V4iwXjn7d0CcHFxaaMDP2aX6DG8GGivSp");

            // Execute Choreo
            LikesResultSet likesResults = likesChoreo.execute(likesInputs);

            
   }

    @Override
    public void showAllLikes() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    

    @Override
    public void showUnreadMessages(TembooSession session) throws JSONException, TembooException {
// Instantiate the Choreo, using a previously instantiated TembooSession object, eg:
// TembooSession session = new TembooSession("smalten", "myFirstApp", "d7c2e7cf553542639bfd278829fb9ae4");

            GetUnreadMessages getUnreadMessagesChoreo = new GetUnreadMessages(session);

            // Get an InputSet object for the choreo
            GetUnreadMessagesInputSet getUnreadMessagesInputs = getUnreadMessagesChoreo.newInputSet();

            // Set inputs
            getUnreadMessagesInputs.set_AccessToken("CAAE5ZAUMG824BAJv4MXBZAupoAbb6rSVZA4ydUw3WwmOlCTGSeSvWHXDvosEp62apjAYHO4eUpfYTAtxlyC1u3ZCkCLW0dGrwaa4Q7J4p1duZBQJ5hms6oi8qqgYnfx85qYFXqZBh12FM0F5utgQ4V4iwXjn7d0CcHFxaaMDP2aX6DG8GGivSp");

            // Execute Choreo
            GetUnreadMessagesResultSet getUnreadMessagesResults = getUnreadMessagesChoreo.execute(getUnreadMessagesInputs);
            JSONArray obj = new JSONArray(getUnreadMessagesResults.get_Response());
                    if(obj!=null)
                    {

                        for (int i=0;i<obj.length();i++){
                            System.out.println("Message "+ i +":\n"+obj.getString(i)+"\n\n");
                            }
                    }
                    else {System.out.println("data est null");} //To change body of generated methods, choose Tools | Templates.
                            }

    

    @Override
    public Boolean disconnect() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }
    
    
    
}
